package pers.cz.common.pub;

import pers.cz.common.sharding.ForceShardingRule;
import pers.cz.common.sharding.ShardingRule;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

/**
 * @program: jef-orm
 * @description: 抽象实体类
 * @author: Cheng Zhi
 * @create: 2023-08-10 11:17
 **/
public abstract class AbstractEntity implements Serializable {

    protected transient Query query;

    /**
     * 静态分表，用于强制指定分表
     */
    protected transient ShardingRule shardingRule;

    public final Query getQuery() {

        if (query == null) {
            query = new ConditionQuery();
        }

        return query;
    }

    public final ShardingRule getShardingRule() {

        if (shardingRule == null) {
            shardingRule = new ForceShardingRule();
        }

        return shardingRule;
    }
}
